﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MerchantPromotionCode.aspx.cs"
    EnableEventValidation="false" Inherits="MerchantPromotionCode" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="css/design.css" rel="stylesheet" type="text/css" />
    <link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="css/bootstrap-responsive.min.css" rel="stylesheet" type="text/css" />
    <link href="css/style.css" rel="stylesheet" type="text/css" />
    <link href="css/style-responsive.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="css/style-metro.css" />
    <script src="js/jquery-1.10.1.min.js" type="text/javascript"></script>
    <%--css for model--%>
    <%--<link href="css/bootstrap-modal.css" rel="stylesheet" type="text/css" />--%>
    <style>
        
        .page-header-fixed .page-container
        {
            margin-top: 0px !important;
        }
        
        @media (max-width: 480px)
        {
            .pull-right
            {
                float: left !important;
            }
        }
        .control-group
        {
            margin-bottom: 0px !important;
        }
        .form-horizontal .control-label
        {
            text-align: left !important;
            padding-top: 0px !important;
        }
        label
        {
            margin-bottom: 0px !important;
            margin-top:1px;
        }
        .lblpadding8
        {
            padding: 0px !important;
        }
        .btn
        {
            line-height: 32px !important;
            padding:7px 15px !important;
        }
        .row-fluid [class*="span"]
        {
            min-height:25px !important;
        }
        .form-horizontal .control-textbox
        {
            width:150px;
        }
        @media (min-width:981px)
        {
            .wdth {width:64%;}
        }
        @media (min-width:641px) and (max-width:980px)
        {
            .wdth {width:93%;}
        }
        .margin
        {
            margin-bottom:10px !important;font-size:12px !important;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server" class="form-horizontal">
    <asp:ScriptManager runat="server" ID="smPromotionCode">
    </asp:ScriptManager>
    <asp:UpdatePanel runat="server" ID="upPromotionCode">
        <ContentTemplate>
            <div class="page-container">
                <div class="main_bg_img">
                    <div class="row-fluid">
                        <div class="row">
                            <div class="span8 offset2 mt">
                                <div class="mt centered">
                                    <img src="img/logo.png" alt="" />
                                </div>
                                <div class="inner_dark white_color">
                                    <div class="pd15" style="font-family: Verdana;">
                                        <h3 class="registrationHeading">
                                            Subscription Detail</h3>
                                        <div id="divMessage" runat="server" class="generalSubMessage">
                                        </div>
                                        <div class="clearfix">
                                        </div>
                                        <div class="row-fluid">
                                            <div class="span8">
                                                <h6 style="text-decoration: underLine;" class="span11">
                                                    Subscription Information</h6>
                                                <div class="span12 prm_code_box" style="min-height: 146px !important;">
                                                    <div class="span8">
                                                        <div class="row-fluid">
                                                            <div class="control-group">
                                                                <label class="control-label">
                                                                    Subscription Type :</label>
                                                                <div class="controls">
                                                                    <asp:Label ID="lblSubscription" runat="server" Text="Gold" CssClass="lblpadding8 span12 "></asp:Label>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="row-fluid ">
                                                            <div class="control-group" id="div3">
                                                                <label class="control-label">
                                                                    Duration :</label>
                                                                <div class="controls">
                                                                    <asp:Label ID="lblDuration" runat="server" Text="4 Month" CssClass="lblpadding8 span12 "></asp:Label>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="clearfix">
                                                        </div>
                                                        <div class="row-fluid ">
                                                            <div class="control-group" id="div5">
                                                                <label class="control-label">
                                                                    Start Date :</label>
                                                                <div class="controls">
                                                                    <asp:Label ID="lblStartDate" runat="server" Text="4 Month" CssClass="lblpadding8 span12"></asp:Label>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="clearfix">
                                                        </div>
                                                        <div class="row-fluid">
                                                            <div class="control-group" id="div7">
                                                                <label class="control-label">
                                                                    End Date :</label>
                                                                <div class="controls">
                                                                    <asp:Label ID="lblOldExpiryDate" runat="server" Text="4 Month" CssClass="lblpadding8 span12 endDate"></asp:Label>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="clearfix">
                                                        </div>
                                                        <div class="row-fluid">
                                                            <asp:LinkButton CssClass="underln txt_upper" runat="server" ID="lnkEdit" Text="Edit"
                                                                PostBackUrl="~/MerchantSubscription.aspx"></asp:LinkButton>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="clearfix">
                                                </div>
                                                <h6 style="text-decoration: underLine; margin-top: 20px;">
                                                    Billing Information</h6>
                                                <div class="span12 prm_code_box" style="min-height: 180px !important;">
                                                    <div class="span8">
                                                        <div class="row-fluid">
                                                            <div class="control-group">
                                                                <label class="control-label" runat="server" id="Label1">
                                                                    <asp:Label ID="lblContactName" runat="server" CssClass="lblpadding8 span12  font-weight"
                                                                        Style="font-size: 15px;"></asp:Label>
                                                                </label>
                                                            </div>
                                                        </div>
                                                        <div class="row-fluid">
                                                            <label runat="server" id="lblAddressLine1">
                                                                B-105,Opp-Karnavati club,
                                                            </label>
                                                            <label runat="server" id="lblAddressLine2">
                                                                Near S.G Highway,
                                                            </label>
                                                            <label id="Label11" runat="server">
                                                                <asp:Label runat="server" ID="lblCity">Ahmedabad</asp:Label>
                                                                <asp:Label runat="server" ID="lblPincode">380013</asp:Label>
                                                            </label>
                                                            <label id="Label2" runat="server">
                                                            </label>
                                                            <label>
                                                                India:</label>
                                                        </div>
                                                        <div class="row-fluid">
                                                            <div class="control-group" id="div10">
                                                                <label class="control-label" runat="server" id="lblContactNo">
                                                                </label>
                                                            </div>
                                                        </div>
                                                        <div class="row-fluid">
                                                            <a class="underln txt_upper" data-toggle="modal" id="astatic" onclick="addressPopup();"
                                                                href="#static">Edit</a>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="span4">
                                                <h6 style="text-decoration: underLine;">
                                                    Promotion Code</h6>
                                                <div class="row-fluid">
                                                    <div class="span12">
                                                        <div class="control-group ">
                                                            <label>
                                                                Insert promotionCode if you have any:</label>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="row-fluid ">
                                                    <div class="span12">
                                                        <div class="control-group">
                                                            <%--<label class="pull-left">--%>
                                                            <asp:TextBox runat="server" ID="txtCityName" TabIndex="1" CssClass="promotionCode wdth"></asp:TextBox>
                                                            <%-- </label>--%>
                                                            <asp:Button runat="server" ID="btnCheck" Style="padding: 0px 30px !important;" Text="Apply"
                                                                TabIndex="2" OnClientClick="return CheckPromotionCode();" CssClass="btn blue prcode pull-right" />
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="clearfix">
                                                </div>
                                                <div style="border: 1px solid black; margin-top: 5px; padding: 10px 20px;">
                                                    <div class="row-fluid">
                                                        <div class="span12">
                                                            <div class="control-group">
                                                                <label class="font-weight">
                                                                    Payment Summary</label>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <br />
                                                    <div class="row-fluid">
                                                        <div class="span12">
                                                            <div class="control-group">
                                                                <label class="pull-left">
                                                                    Sub Total :</label>
                                                                <div class="pull-right">
                                                                    <asp:Label ID="lblSubTotal" runat="server" Text="1000" CssClass="lblpadding8 span12 subTotal"></asp:Label>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="clearfix">
                                                    </div>
                                                    <div class="row-fluid ">
                                                        <div class="span12">
                                                            <div class="control-group" id="div1">
                                                                <label class=" pull-left">
                                                                    Total Saving :</label>
                                                                <div class="pull-right">
                                                                    <asp:Label runat="server" ID="lblDiscount" Text="1000" CssClass="lblpadding8 span12 discount"></asp:Label>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="clearfix">
                                                    </div>
                                                    <div class="row-fluid">
                                                        <div class="span12 ">
                                                            <div class="control-group" id="div2">
                                                                <label class="pull-left">
                                                                    Grand Total :</label>
                                                                <div class="pull-right">
                                                                    <asp:Label ID="lblGrandTotal" runat="server" Text="1000" CssClass="lblpadding8 span12 grandTotal font-weight"></asp:Label>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="span10 offset1 mt_lg">
                                                        <img src="img/cards.jpg" alt="" />
                                                    </div>
                                                    <div class="row-fluid " style="margin-top: 5px;">
                                                        <div class="span12 ">
                                                            <div class="control-group" id="div12" style="font-size: 11px;">
                                                                By clicking Place Order you are agreeing to the <a href="ProductImages/Support365_Sales_Presentation.pdf"
                                                                    class="underln black" target="_blank">Terms and Conditions </a>of our service
                                                                agreement.
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="centered" style="padding-bottom: 5px; margin-top: 10px;">
                                                        <asp:Button runat="server" ID="btnSave" Style="font-weight: bold;" Text="Place Order >>>"
                                                            TabIndex="3" OnClick="OnNext" CssClass="btn blue" />
                                                    </div>
                                                    <div class="clearfix">
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="clearfix">
                                        </div>
                                        <div class="row-fluid  registrationBtn">
                                            <div class="span6 " style="">
                                                <a href="" class="footerInfo underln">ALREADY REGISTERD LOGIN NOW!</a>
                                                <div class="footerInfo2">
                                                    For any queries, e-mail us:suppor@gmail.com
                                                </div>
                                            </div>
                                            <!--/span-->
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div id="myModal2" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel2"
                aria-hidden="true" style="top: 15%; opacity: 1.5;">
                <div class="modal-header">
                    <h3 id="myModalLabel2">
                        Edit Billing Information </h3>
                </div>
                <div class="modal-body">
                    <div class="row-fluid">
                        <div class="span12">
                            <div class="portlet box " style="background-color: #eee;">
                             
                                <div class="portlet-body form">
                                    <div id="div4" runat="server" class="generalMessage">
                                    </div>
                                     <div class="row-fluid">
                                        <div class="control-group margin" id="divName">
                                            <label class="control-label">
                                                Contact Name</label>
                                            <div class="controls">
                                                <asp:TextBox runat="server" ClientIDMode="Static" placeholder="Contact Name" ID="txtContactName"
                                                    TabIndex="6" CssClass="m-wrap span9 name"></asp:TextBox>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row-fluid">
                                        <div class="control-group margin" id="divAddress">
                                            <label class="control-label">
                                                Address Line1</label>
                                            <div class="controls">
                                                <asp:TextBox runat="server" ClientIDMode="Static" placeholder="Address Line1" ID="txtAddress1"
                                                    TabIndex="6" CssClass="m-wrap span9 address"></asp:TextBox>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row-fluid">
                                        <div class="control-group margin">
                                            <label class="control-label">
                                                Address Line2</label>
                                            <div class="controls">
                                                <asp:TextBox runat="server" ID="txtAddress2" placeholder="Address Line2" TabIndex="7"
                                                    CssClass="m-wrap span9"></asp:TextBox>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row-fluid">
                                        <div class="control-group margin" id="divState">
                                            <label class="control-label">
                                                State</label>
                                            <div class="controls">
                                                <asp:DropDownList runat="server" ID="drpState" onchange="BindCity();" TabIndex="8"
                                                    DataValueField="Id" DataTextField="Name" CssClass="m-wrap span9 state">
                                                </asp:DropDownList>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row-fluid">
                                        <div class="control-group margin"  id="divCity">
                                            <label class="control-label">
                                                City</label>
                                            <div class="controls">
                                                <asp:DropDownList runat="server" ID="drpCity" DataTextField="Name" DataValueField="Id"
                                                    onchange="getCityId();" TabIndex="9" CssClass="m-wrap span9 city">
                                                </asp:DropDownList>
                                                <asp:TextBox ID="lblCityId" Style="display: none;" runat="server" class="drpCityId"></asp:TextBox>
                                                <%-- <select runat="server" id="drpCity"></select>--%>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row-fluid">
                                        <div class="control-group margin" id="divPinCode">
                                            <label class="control-label">
                                                Postal Code</label>
                                            <div class="controls">
                                                <asp:TextBox runat="server" ID="txtPostalCode" placeholder="Postal Code" TabIndex="10"
                                                    CssClass="m-wrap span9 pinCode"></asp:TextBox>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!-- END PAGE CONTENT-->
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" data-dismiss="modal" class="btn  closebox" onclick="closePopUp();">
                        Cancel</button>
                    <asp:Button ID="btnAddress" runat="server" CssClass="btn green" Text="Update" OnClick="OnUpdateBillingInformation"
                        OnClientClick="return frmAddressValidation();"></asp:Button>
                    <%--<a href="#" class="btn green frmAddressValidation">Update</a>--%>
                </div>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    <div class="modal-backdrop hide">
    </div>
    <%--disbale browsers back button--%>
    <script>
        function CheckPromotionCode() {
            var Id = '<%= Session["SubscriptionId"]%>';
            $.ajax({
                type: 'POST',
                url: 'MerchantPromotionCode.aspx/CheckPromotionCode',
                data: '{Code:"' + $('.promotionCode').val() + '",Total:"' + $('.subTotal').html() + '"}',
                contentType: 'application/json;charset=utf-8',
                dataType: 'json',
                success: function (response) {
                    //                    alert(response.d[0]);
                    //                    alert(response.d[1]);

                    $('.grandTotal').html(response.d[0]);
                    $('.discount').html(response.d[1]);
                    $('.endDate').html(response.d[2] + response.d[4]);

                    if (response.d[3] <= 0) {

                        if ($('.promotionCode').val() != "") {
                            $('.generalSubMessage').html("<strong>Error! <strong/>Invalid PromotionCode ");
                            $('.generalSubMessage').addClass("alert alert-danger");
                        }
                        else {

                            $('.generalSubMessage').html("");
                            $('.generalSubMessage').removeClass("alert alert-danger");
                        }
                    }
                    else {

                        $('.generalSubMessage').html("<strong>Succeed! <strong/>");
                        $('.generalSubMessage').removeClass("alert alert-danger");
                        $('.generalSubMessage').addClass("alert alert-success");
                        if (response.d[1] == "0") {
                            $('.endDate').addClass("expiryDate");
                          
                        }
                        else {
                            $('.endDate').removeClass("expiryDate");
                        }

                        $('[id$="btnCheck"]').attr('disabled', 'disabled');
                    }
                    alert(res);
                },
                failure: function () {
                    alert('hello');
                }
            });
            return false;
        }
        function BindCity() {
            $('#drpCity').empty();
            // alert('jay jalaram');
            $.ajax({
                type: "POST",
                contentType: "application/json; charset=utf-8",
                url: "./MerchantRegistration.aspx/LoadCity",
                data: "{stateId:'" + $('#<%= drpState.ClientID %>').val() + "'}",
                dataType: "json",
                success: function (Result) {
                    $("#drpCity").append($("<option></option>").val("0").html("Select"));
                    $.each(Result.d, function (key, value) {
                        $("#drpCity").append($("<option></option>").val(value.Id).html(value.Name));
                    });
                },
                error: function (Result) {
                    alert("Error");
                }
            });
        }
        //        $('.frmAddressValidation').click(function () {
        function frmAddressValidation() {
            var isError = "false";

            if ($('.name').val() == "") {
                $('.name').closest("#divName").addClass("error");
                isError = "true"
            }
            else {
                $('.name').closest("#divName").removeClass("error");
            }
            if ($('.address').val() == "") {
                $('.address').closest("#divAddress").addClass("error");
                isError = "true"
            }
            else {
                $('.address').closest("#divAddress").removeClass("error");
            }

            var state = $('#<%= drpState.ClientID %>').val();

            if (state == "" || state == "0") {
                $('.state').closest("#divState").addClass("error");
                isError = "true"
            }
            else {
                $('.state').closest("#divState").removeClass("error");
            }

            var city = $('#<%= drpCity.ClientID %>').val();
            if (city == " " || city == "0") {
                $('.city').closest("#divCity").addClass("error");
                isError = "true"
            }
            else {
                $('.city').closest("#divCity").removeClass("error");
            }

            if ($('.pinCode').val() == "") {
                $('.pinCode').closest("#divPinCode").addClass("error");
                isError = "true"
            }
            else {
                $('.pinCode').closest("#divPinCode").removeClass("error");
            }

            if (isError == "true") {

                $(".generalMessage").html('<strong>Error!</strong> Please check your validation in red.');
                $(".generalMessage").addClass("alert alert-danger");
              
                return false;
            }
            else {
             
                return true;
            }
        }
        //});
    </script>
    <script type="text/javascript">
        jQuery(document).ready(function () {

            //$('.date-picker').datepicker({ autoclose: true, endDate: "0d" });

            //$('.date-picker').datepicker({ autoclose: true });


            $(".closebox").on('click', function () {
                $("#myModal2").hide();
                $(".modal-backdrop").hide();
            });
        });
        function addressPopup() {
            $("#myModal2").show();
            $('.modal-backdrop').show();
        }
        function closePopUp() {
            $("#myModal2").hide();
            $('.modal-backdrop').hide();
        }
        function getCityId() {
            $(".drpCityId").val($("#drpCity").val());
        }

    </script>
    <%--  msg popup--%>
    <%--   <script src="js/bootstrap-modal.js" type="text/javascript"></script>
    <script src="js/bootstrap-modalmanager.js" type="text/javascript"></script>
    <script src="js/ui-modals.js"></script>--%>
    </form>
</body>
</html>
